package club.hicode.daydayup.byteman;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.jsonzou.jmockdata.JMockData;
import org.junit.Test;
import org.mockito.Mock;

/**
 * 测试
 *
 * @author Liu Chunfu
 * @date 2018-05-07 上午10:31
 **/
public class SearilTest {

    @Test
    public void test1() {
        BytePerson mock = JMockData.mock(BytePerson.class);
        String s = JSON.toJSONString(mock);
        System.out.println(s);
    }

    @Test
    public void test2() throws JsonProcessingException {
        BytePerson bytePerson = new BytePerson();
        bytePerson.setName("LCF");
        bytePerson.setByteTest("LOVE".getBytes());

        ObjectMapper objectMapper = new ObjectMapper();
        String s1 = objectMapper.writeValueAsString(bytePerson);

        System.out.println(s1);
        System.out.println("=========");
        String s = JSON.toJSONString(bytePerson);
        System.out.println(s);
        System.out.println("=========");
        System.out.println("LOVE".getBytes());
    }

    @Test
    public void test3() {
        byte[] bytes = "LOVE".getBytes();
        for (byte aByte : bytes) {
            System.out.println(aByte);
        }
    }

    @Test
    public void test4() {
        byte[] bytes = new byte[]{76, 79, 86, 69};
        String str = new String(bytes);
        System.out.println(str);
    }

}
